<?php

namespace App\Models;

use App\Enums\ShippingStatus;
use BenSampo\Enum\Traits\CastsEnums;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * @mixin IdeHelperEntityApplyRecord
 */
class EntityApplyRecord extends BaseModel
{
    use CastsEnums;

    protected $casts = [
        'status' => ShippingStatus::class,
    ];

    public function user(): BelongsTo
    {
        return $this->belongsTo(FrontendUser::class, 'user_id');
    }

    public function entity(): BelongsTo
    {
        return $this->belongsTo(RightsEntity::class, 'entity_id');
    }

    public function product(): BelongsTo
    {
        return $this->belongsTo(Product::class, 'product_id');
    }
}
